﻿using SolidWorks.Interop.sldworks;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MechAddin.Common
{
    internal abstract class SWBase
    {
        protected SldWorks SldWorks => SWAddin.Sldworks;
        protected ModelDoc2 SWDoc => SldWorks.ActiveDoc;
        protected PartDoc SWDoc1 => SWDoc as PartDoc;
        protected AssemblyDoc SWDoc2 => SWDoc as AssemblyDoc;
        protected DrawingDoc SWDoc3 => SWDoc as DrawingDoc;
        protected ModelDocExtension SWModelEx => SWDoc?.Extension;
        protected SelectionMgr SelMgr => SWDoc?.SelectionManager;
        protected SketchManager SkMgr => SWDoc?.SketchManager;
        protected FeatureManager FeatMgr => SWDoc?.FeatureManager;
        protected MathUtility MathUtility => SldWorks.GetMathUtility();

        protected void SendMsg(string message)
        {
            SldWorks.SendMsgToUser(message);
        }
        protected void UpdateView(bool b)
        {

            ModelView modelView = SWDoc.ActiveView;
            modelView.EnableGraphicsUpdate = b;
            modelView.UpdateAllGraphicsLayers = b;
            FeatMgr.EnableFeatureTree = b;
            FeatMgr.EnableFeatureTreeWindow = b;
            FeatMgr.UpdateFeatureTree();
            SWDoc.GraphicsRedraw2();
            SWDoc.EditRebuild3();
        }
    }
}
